/*
 * @Description: 电子文件级功能栏
 * @Author: Zzt
 * @Date: 2022-12-28 11:43:04
 * @LastEditTime: 2023-01-06 16:02:26
 */

import RecordDownload from '@/components/functionalBtns/RecordDownload';
import { Button, Divider, Space } from 'antd';
import { useMemo } from 'react';
import { useArchiveCollectionContext } from '../../contexts/ArchiveCollectionContext';
import HitchBtn from '../optBtns/HitchBtn';

interface IERecordOperatesProps {
  selectItems: number[];
  levelParams: any;
  data: any;
}

const ERecordOperates = (props: IERecordOperatesProps) => {
  const { selectItems, levelParams, data } = props;
  const { deleteItem, recordsData } = useArchiveCollectionContext();
  // 下载
  const recordDownload = useMemo(
    () => (
      <RecordDownload
        selectItems={selectItems}
        baseInfo={{ ...recordsData?.downLevel, ...recordsData?.downLevel?.commonParams }}
      />
    ),
    [selectItems]
  );
  return (
    <Space size="small">
      <HitchBtn levelParams={levelParams} upperInfo={data} />
      <Button
        disabled={!selectItems}
        onClick={() => deleteItem(0, { ...levelParams, entryIdList: selectItems })}
      >
        原文删除
      </Button>
      {recordDownload}
      <Button disabled>更多</Button>
      <Divider type="vertical" />
      {/* <Button>筛选检索</Button> */}
    </Space>
  );
};
export default ERecordOperates;
